package com.resource.studentmanage.controller;

import java.util.Arrays;
import java.util.Map;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.resource.common.utils.AppResponse;
import com.resource.common.utils.R;
import com.resource.studentmanage.entity.TStudentInformationEntity;
import com.resource.studentmanage.service.TStudentInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


import com.resource.common.utils.PageUtils;


/**
 * 学生信息表
 *
 * @author zkx
 * @email 1486664603@qq.com
 * @date 2023-03-06 20:53:55
 */
@RestController
@RequestMapping("student/tstudentinformation")
public class TStudentInformationController {
    @Autowired
    private TStudentInformationService tStudentInformationService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params) {
        PageUtils page = tStudentInformationService.queryPage(params);
        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id) {
        TStudentInformationEntity tStudentInformation = tStudentInformationService.getById(id);

        return R.ok().put("tStudentInformation", tStudentInformation);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody TStudentInformationEntity tStudentInformation) {
        tStudentInformationService.save(tStudentInformation);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody TStudentInformationEntity tStudentInformation) {
        tStudentInformationService.updateById(tStudentInformation);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        tStudentInformationService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
